package com.hspedu.enum_;

/*
 *@auther will
 *@version 1.0
 */public class Enumeration03 {
    public static void main(String[] args) {
        System.out.println(Season2.AUTUMN);
    }
}

//演示使用enumeration关键字
enum Season2{


    //定义了四个对象,无法修改
//    public static Season2 SPRING = new Season2("春天","温暖");
//    public static Season2 WINTER = new Season2("冬天","寒冷");
//    public static Season2 SUMMER = new Season2("夏天","炎热");
//    public static Season2 AUTUMN = new Season2("秋天","凉爽");
    //如果使用enum 来实现枚举类
    //1. 使用关键字 enum 替代 class
    //2. public static Season2 SPRING = new Season2("春天","温暖");  直接使用
    //   SPRING("春天","温暖");  常量名(实参列表)
    //3. 如果有多个常量(对象) ，使用 , 间隔
    //4. 如果使用enum 来实现，要求将定义的常量对象写在最前面
    SPRING("春天","温暖"),WINTER("冬天","寒冷"),SUMMER("夏天","炎热"),AUTUMN("秋天","凉爽");
    private String name;
    private String decs;// 描述

    private Season2(){//无参构造器

    }

    private Season2(String name, String decs) {
        this.name = name;
        this.decs = decs;
    }

    public String getName() {
        return name;
    }

    public String getDecs() {
        return decs;
    }

    @Override
    public String toString() {
        return "Season{" +
                "name='" + name + '\'' +
                ", decs='" + decs + '\'' +
                '}';
    }
}

